<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>

<div class="container-fluid am-margin-top">
    <form id="nodeRelForm">
        <input type="hidden" name="id"/>
        <input type="hidden" name="lcbh" value="${param.lcbh}"/>
	    <div class="row">
			<div class="col-md-6">
				<div class="form-group"><label>来源环节</label>
					<select class="form-control"  name="lyhj" check-type="required">
						<c:forEach var="node" items="${nodeList}">
							<option value="${node.ID}">${node.HJMC }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group"><label>目标环节</label>
					<select class="form-control"  name="mbhj" check-type="required">
						<c:forEach var="node" items="${nodeList}">
							<option value="${node.ID}">${node.HJMC }</option>
						</c:forEach>
					</select>
				</div>
			</div>
	    </div>
	    <div class="row">
			<div class="col-md-12">
				<div class="form-group"><label>流转规则</label>
					<textarea name="lzgz"  class="form-control" check-type="required"></textarea>
				</div>
			</div>
	    </div>
	    <nav class="navbar navbar-default">
		  <div class="container-fluid">
		  	<div class="collapse navbar-collapse">
		  		<ul class="nav navbar-nav navbar-right">
			  		<li>
			  			<button type="button" class="btn btn-primary navbar-btn" id="nodeRelFormSaveBt">保存</button>
			  		</li>
			  	</ul>
	        </div>
		  </div>
		</nav>
	
    </form>
</div>
<script type="text/javascript">
    
    $(function () {
        var id = '${param.id}';
        var winId = '${param.winId}';
        $("#nodeRelForm").validation();
        //初始化
        if (id) {
            $.getJSON(ctx + '/flowDefAct/queryNodeRelById.do', {id: id}, function (data) {
                webUtils.fullForm({
                    form: $("#nodeRelForm"),
                    data: data
                });
            });
        }
        //事件
        $("#nodeRelFormSaveBt").click(function () {
        	if($("#nodeRelForm").valid()){
        		$("#nodeRelForm").ajaxSubmit({
                    url: ctx + '/flowDefAct/saveNodeRel.do',
                    data: {},
                    type: "POST",
                    success: function (data) {
                        if (data.success) {
                            webUtils.alert("提交成功");
                            top.webUtils.topicPublish("dialog.submit.success."+winId, data);
                        } else {
                        	webUtils.error(data.msg);
                        }
                    }
                });
        	}
        });
    });
</script>
